//
//  UITableView+CXTableView.m
//  智积分
//
//  Created by apple on 2018/6/8.
//  Copyright © 2018 Cynic. All rights reserved.
//

#import "UITableView+CXTableView.h"

@implementation UITableView (CXTableView)


static void *TableViewPlaceImg;


-(UIImageView *)placeImageView{
    return objc_getAssociatedObject(self,&TableViewPlaceImg);
}

-(void)setPlaceImageView:(UIImageView *)placeImageView {
    objc_setAssociatedObject(self, &TableViewPlaceImg, placeImageView,OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}

-(void)placeImageWithData:(NSString *)imageName withOffset:(CGFloat)offset{
    self.placeImageView = [[UIImageView alloc]init];
    UIImage *img = [UIImage imageNamed:imageName];
    self.placeImageView.bounds = CGRectMake(0, 0, 120, 120 / img.size.width * img.size.height);
    self.placeImageView.center = CGPointMake(cx_wid / 2 , self.bounds.size.height / 2 + offset);
    self.placeImageView.hidden = YES;
    self.placeImageView.image = img;
    self.placeImageView.contentMode =  UIViewContentModeCenter;
    [self addSubview:self.placeImageView];
    [self sendSubviewToBack:self.placeImageView];
}
@end
